<?php

Yii::import('zii.widgets.CMenu');

/**
 *
 * @author Zsolt Lengyel
 *
 */
class ActiveMenu extends CMenu{


   public function init(){

      foreach (Page::model()->actives()->topLevel()->findAll() as $page){

         $url = empty($page->controller) ? array('page/view', 'id'=>$page->id, 'title'=> $page->urlTitle) : array($page->controller);

         $this->items[] = array('label'=>$page->title, 'url'=>$url );

      }


      parent::init();
   }


}